package io.jee.runshan.service.remote.qiye.impl;

import io.jee.medusa.remote.RemoteConnector;
import io.jee.runshan.domain.remote.qiye.base.Response;
import io.jee.runshan.domain.remote.qiye.request.MessageSendData;
import io.jee.runshan.service.remote.qiye.IMessageService;
import io.jee.runshan.utils.JsonUtil;
import io.jee.runshan.utils.QiyeConstant;

import org.springframework.stereotype.Component;

@Component
public class MessageServiceImpl implements IMessageService {

	@Override
	public Response send(MessageSendData data) {
		String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + QiyeConstant.getApptoken();
		String params = JsonUtil.beanToJson(data);
		return RemoteConnector.post(url, params, Response.class);
	}

}
